package com.jshop.controller.admin;
import org.json.JSONException;
import org.json.JSONObject;

import com.jfinal.aop.Before;
import com.jfinal.core.Controller;
import com.jshop.interceptor.AdminInterceptor;
@Before(AdminInterceptor.class)
public class BaseController extends Controller {
	public boolean isPost(){
		if("POST".equalsIgnoreCase(getRequest().getMethod())){
			return true;
		}else{
			return false;
		}
	}
	// 输出JSON成功消息，返回null
	public void ajaxJsonSuccessMessage(String message) throws JSONException {
		JSONObject obj=new JSONObject();
		obj.put("status", 1);
		obj.put("msg", message);
		renderJson(obj.toString());
	}

	// 输出JSON错误消息，返回null
	public void ajaxJsonErrorMessage(String message) throws JSONException {
		JSONObject obj=new JSONObject();
		obj.put("status", 0);
		obj.put("msg", message);
		renderJson(obj.toString());
	}
}
